from alg import Solution

def load_test_case(filename):
    with open(filename, 'r') as f:
        lines = f.readlines()
        candidates = eval(lines[0].split('=')[1].strip())
        target = eval(lines[1].split('=')[1].strip())
    return candidates, target

def test_algorithm():
    # 测试5个测试用例
    for i in range(5):
        filename = f"test_case_{i+1}.txt"
        candidates, target = load_test_case(filename)
        print(f"\nTest case {i+1}:")
        print(f"candidates = {candidates}, target = {target}")
        solution = Solution()
        result = solution.combinationSum(candidates, target)
        print(f"Result: {result}")

if __name__ == "__main__":
    test_algorithm()